﻿using System;
using System.Windows.Input;

namespace StoreTools.Common
{
    public class CommandBase : ICommand
    {
        public event EventHandler CanExecuteChanged;

        public bool CanExecute(object parameter)
        {
            return this.CanExecuteFunc?.Invoke(parameter) == true;
        }

        public void Execute(object parameter)
        {
            this.ExcuteAction?.Invoke(parameter);
        }

        public Action<object> ExcuteAction { get; set; }
        public Func<object, bool> CanExecuteFunc { get; set; }
    }
}
